credit2: Fix runq_tickle to use idle, tickled masks
authorKeir Fraser <keir@xen.org>
Fri, 29 Oct 2010 09:20:08 +0000 (10:20 +0100)
committerKeir Fraser <keir@xen.org>
Fri, 29 Oct 2010 09:20:08 +0000 (10:20 +0100)
commit1b561702db4910590f1a5607209e645490fde5bb
tree689fb9dd8b106b19987e65642053272b5ec02765
parent432b2c403e0d448cd8103d7c0893d020975f93b3
credit2: Fix runq_tickle to use idle, tickled masks

The previous code had a bug where, if a second vcpu woke up and ran
runq_tickle before the first vcpu had actually started running on a
tickled processor, the code would choose the same cpu to tickle, and
the result would be a "missed tickle" -- only one of the vcpus would
run, despite having idle processors.

This change:
* Keeps a mask of idle cpus
* Keeps a mask of cpus which have been tickled, but not entered
schedule yet.

The new tickle code first looks at the set of idle-but-not-tickled
cpus; if it's not empty, it tickles one.

If that doesn't work, it looks at the set of not-idle-but-not-tickled
cpus, finds the one with the lowest credit; if that's lower than the
waking vcpu, it tickles that one.

If any cpu is tickled, its bit in the tickled mask is set, and cleared
when schedule() is called.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/common/sched_credit2.c